//
//  UIDevice+Extension.swift
//  AESOLAR_IOS
//
//  Created by Mr.Wang on 2019/8/27.
//  Copyright © 2019 Mr.Wang. All rights reserved.
//

import UIKit

extension UIDevice {

    var currentLanguage: String {
        if let language = NSLocale.preferredLanguages.first {
            return language
        }
        return ""
    }
    
    var isZhHans: Bool {
        var isZh = false
        
        if let userLanguage = AppCache.shared.object(for: APPUserDefault.self).userSelectLanguage {
            switch userLanguage {
            case .chinese:
                isZh = true
            default:
                break
            }
        } else {
            if UIDevice.current.currentLanguage.contains("zh-Hans") {
                isZh = true
            }
        }
        return isZh
    }
    
}
